/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.Cloudtap.UI;
import com.Cloudtap.Backend.*;
import java.util.*;

/**
 *
 * @author Dharshan
 */
public class DataModel {

    private Vector<iVM> vmList;
    private Vector<iVMType> vmTypeList;
    private Vector<iVMProvider> providers;

    public DataModel()
    {
        vmList = new Vector<iVM>();
        vmTypeList = new Vector<iVMType>();

        providers = BootStrapper.GetProviders();
        for(iVMProvider provider : providers)
        {
            vmTypeList.addAll(provider.getVMTypes());
            vmList.addAll(provider.getVMs());
        }
    }

    public Vector<iVM> GetVMs()
    {
        return vmList;
    }

    public Vector<iVMType> GetVMTypes()
    {
        return vmTypeList;
    }

    public Hashtable<UUID,String> GetUnionOfColumns()
    {
        Hashtable<UUID,String> aggregateProperties = new Hashtable<UUID,String>();
        for (iVMType type : this.vmTypeList)
        {
            aggregateProperties.putAll(type.GetSupportedCustomProperties());
        }
        return aggregateProperties;
    }
}
